.class Lcom/example/m6shop/PhoneImgActivity$4;
.super Ljava/lang/Thread;
.source "PhoneImgActivity.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/example/m6shop/PhoneImgActivity;->uploadFile()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/example/m6shop/PhoneImgActivity;


# direct methods
.method constructor <init>(Lcom/example/m6shop/PhoneImgActivity;)V
    .locals 0

    .prologue
    .line 1
    iput-object p1, p0, Lcom/example/m6shop/PhoneImgActivity$4;->this$0:Lcom/example/m6shop/PhoneImgActivity;

    .line 252
    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 18

    .prologue
    .line 254
    invoke-super/range {p0 .. p0}, Ljava/lang/Thread;->run()V

    .line 255
    const-string v8, "\r\n"

    .line 256
    .local v8, "end":Ljava/lang/String;
    const-string v13, "--"

    .line 257
    .local v13, "twoHyphens":Ljava/lang/String;
    const-string v2, "*****"

    .line 260
    .local v2, "boundary":Ljava/lang/String;
    :try_start_0
    new-instance v15, Ljava/lang/StringBuilder;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/example/m6shop/PhoneImgActivity$4;->this$0:Lcom/example/m6shop/PhoneImgActivity;

    move-object/from16 v16, v0

    move-object/from16 v0, v16

    iget-object v0, v0, Lcom/example/m6shop/PhoneImgActivity;->m:Lmyapp/MyApp;

    move-object/from16 v16, v0

    invoke-virtual/range {v16 .. v16}, Lmyapp/MyApp;->getWebConfig()Ljava/lang/String;

    move-result-object v16

    invoke-static/range {v16 .. v16}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v16

    invoke-direct/range {v15 .. v16}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v16, "/index.php?ctrl=app&action=updateimg&datatype=json"

    invoke-virtual/range {v15 .. v16}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    .line 261
    .local v10, "httpUrl":Ljava/lang/String;
    new-instance v14, Ljava/net/URL;

    invoke-direct {v14, v10}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 262
    .local v14, "url":Ljava/net/URL;
    invoke-virtual {v14}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v6

    check-cast v6, Ljava/net/HttpURLConnection;

    .line 264
    .local v6, "con":Ljava/net/HttpURLConnection;
    const/4 v15, 0x1

    invoke-virtual {v6, v15}, Ljava/net/HttpURLConnection;->setDoInput(Z)V

    .line 265
    const/4 v15, 0x1

    invoke-virtual {v6, v15}, Ljava/net/HttpURLConnection;->setDoOutput(Z)V

    .line 266
    const/4 v15, 0x0

    invoke-virtual {v6, v15}, Ljava/net/HttpURLConnection;->setUseCaches(Z)V

    .line 268
    const-string v15, "POST"

    invoke-virtual {v6, v15}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V

    .line 270
    const-string v15, "Connection"

    const-string v16, "Keep-Alive"

    move-object/from16 v0, v16

    invoke-virtual {v6, v15, v0}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 271
    const-string v15, "Charset"

    const-string v16, "UTF-8"

    move-object/from16 v0, v16

    invoke-virtual {v6, v15, v0}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 272
    const-string v15, "Content-Type"

    .line 273
    new-instance v16, Ljava/lang/StringBuilder;

    const-string v17, "multipart/form-data;boundary="

    invoke-direct/range {v16 .. v17}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, v16

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v16

    invoke-virtual/range {v16 .. v16}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v16

    .line 272
    move-object/from16 v0, v16

    invoke-virtual {v6, v15, v0}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 276
    new-instance v7, Ljava/io/DataOutputStream;

    invoke-virtual {v6}, Ljava/net/HttpURLConnection;->getOutputStream()Ljava/io/OutputStream;

    move-result-object v15

    invoke-direct {v7, v15}, Ljava/io/DataOutputStream;-><init>(Ljava/io/OutputStream;)V

    .line 277
    .local v7, "ds":Ljava/io/DataOutputStream;
    new-instance v15, Ljava/lang/StringBuilder;

    invoke-static {v13}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v16

    invoke-direct/range {v15 .. v16}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v15, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v15

    invoke-virtual {v7, v15}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V

    .line 278
    new-instance v15, Ljava/lang/StringBuilder;

    const-string v16, "Content-Disposition: form-data; name=\"file1\";filename=\""

    invoke-direct/range {v15 .. v16}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/example/m6shop/PhoneImgActivity$4;->this$0:Lcom/example/m6shop/PhoneImgActivity;

    move-object/from16 v16, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/example/m6shop/PhoneImgActivity$4;->this$0:Lcom/example/m6shop/PhoneImgActivity;

    move-object/from16 v17, v0

    move-object/from16 v0, v17

    iget-object v0, v0, Lcom/example/m6shop/PhoneImgActivity;->picPath:Ljava/lang/String;

    move-object/from16 v17, v0

    invoke-virtual/range {v16 .. v17}, Lcom/example/m6shop/PhoneImgActivity;->getFileName(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v16

    invoke-virtual/range {v15 .. v16}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    const-string v16, "\""

    invoke-virtual/range {v15 .. v16}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v15

    invoke-virtual {v7, v15}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V

    .line 279
    invoke-virtual {v7, v8}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V

    .line 281
    new-instance v9, Ljava/io/FileInputStream;

    move-object/from16 v0, p0

    iget-object v15, v0, Lcom/example/m6shop/PhoneImgActivity$4;->this$0:Lcom/example/m6shop/PhoneImgActivity;

    iget-object v15, v15, Lcom/example/m6shop/PhoneImgActivity;->picPath:Ljava/lang/String;

    invoke-direct {v9, v15}, Ljava/io/FileInputStream;-><init>(Ljava/lang/String;)V

    .line 283
    .local v9, "fStream":Ljava/io/FileInputStream;
    const/16 v4, 0x400

    .line 284
    .local v4, "bufferSize":I
    new-array v3, v4, [B

    .line 285
    .local v3, "buffer":[B
    const/4 v12, -0x1

    .line 287
    .local v12, "length":I
    :goto_0
    invoke-virtual {v9, v3}, Ljava/io/FileInputStream;->read([B)I

    move-result v12

    const/4 v15, -0x1

    if-ne v12, v15, :cond_0

    .line 292
    invoke-virtual {v7, v8}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V

    .line 293
    new-instance v15, Ljava/lang/StringBuilder;

    invoke-static {v13}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v16

    invoke-direct/range {v15 .. v16}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v15, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v15

    invoke-virtual {v15}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v15

    invoke-virtual {v7, v15}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V

    .line 295
    invoke-virtual {v9}, Ljava/io/FileInputStream;->close()V

    .line 296
    invoke-virtual {v7}, Ljava/io/DataOutputStream;->flush()V

    .line 298
    invoke-virtual {v6}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v11

    .line 300
    .local v11, "is":Ljava/io/InputStream;
    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    .line 301
    .local v1, "b":Ljava/lang/StringBuffer;
    :goto_1
    invoke-virtual {v11}, Ljava/io/InputStream;->read()I

    move-result v5

    .local v5, "ch":I
    const/4 v15, -0x1

    if-ne v5, v15, :cond_1

    .line 308
    sget-object v15, Ljava/lang/System;->out:Ljava/io/PrintStream;

    new-instance v16, Ljava/lang/StringBuilder;

    const-string v17, "\u8fd4\u56de\u6570\u636e-"

    invoke-direct/range {v16 .. v17}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v17

    invoke-virtual/range {v17 .. v17}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v17

    invoke-virtual/range {v16 .. v17}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v16

    invoke-virtual/range {v16 .. v16}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v16

    invoke-virtual/range {v15 .. v16}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    .line 311
    invoke-virtual {v7}, Ljava/io/DataOutputStream;->close()V

    .line 318
    .end local v1    # "b":Ljava/lang/StringBuffer;
    .end local v3    # "buffer":[B
    .end local v4    # "bufferSize":I
    .end local v5    # "ch":I
    .end local v6    # "con":Ljava/net/HttpURLConnection;
    .end local v7    # "ds":Ljava/io/DataOutputStream;
    .end local v9    # "fStream":Ljava/io/FileInputStream;
    .end local v10    # "httpUrl":Ljava/lang/String;
    .end local v11    # "is":Ljava/io/InputStream;
    .end local v12    # "length":I
    .end local v14    # "url":Ljava/net/URL;
    :goto_2
    return-void

    .line 290
    .restart local v3    # "buffer":[B
    .restart local v4    # "bufferSize":I
    .restart local v6    # "con":Ljava/net/HttpURLConnection;
    .restart local v7    # "ds":Ljava/io/DataOutputStream;
    .restart local v9    # "fStream":Ljava/io/FileInputStream;
    .restart local v10    # "httpUrl":Ljava/lang/String;
    .restart local v12    # "length":I
    .restart local v14    # "url":Ljava/net/URL;
    :cond_0
    const/4 v15, 0x0

    invoke-virtual {v7, v3, v15, v12}, Ljava/io/DataOutputStream;->write([BII)V

    goto :goto_0

    .line 313
    .end local v3    # "buffer":[B
    .end local v4    # "bufferSize":I
    .end local v6    # "con":Ljava/net/HttpURLConnection;
    .end local v7    # "ds":Ljava/io/DataOutputStream;
    .end local v9    # "fStream":Ljava/io/FileInputStream;
    .end local v10    # "httpUrl":Ljava/lang/String;
    .end local v12    # "length":I
    .end local v14    # "url":Ljava/net/URL;
    :catch_0
    move-exception v15

    goto :goto_2

    .line 303
    .restart local v1    # "b":Ljava/lang/StringBuffer;
    .restart local v3    # "buffer":[B
    .restart local v4    # "bufferSize":I
    .restart local v5    # "ch":I
    .restart local v6    # "con":Ljava/net/HttpURLConnection;
    .restart local v7    # "ds":Ljava/io/DataOutputStream;
    .restart local v9    # "fStream":Ljava/io/FileInputStream;
    .restart local v10    # "httpUrl":Ljava/lang/String;
    .restart local v11    # "is":Ljava/io/InputStream;
    .restart local v12    # "length":I
    .restart local v14    # "url":Ljava/net/URL;
    :cond_1
    int-to-char v15, v5

    invoke-virtual {v1, v15}, Ljava/lang/StringBuffer;->append(C)Ljava/lang/StringBuffer;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1
.end method

.method public declared-synchronized start()V
    .locals 1

    .prologue
    .line 320
    monitor-enter p0

    :try_start_0
    invoke-super {p0}, Ljava/lang/Thread;->start()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 321
    monitor-exit p0

    return-void

    .line 320
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method
